package edu.uniquindio.prmaven.proyectofinal;

import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.testng.Assert;
import org.testng.annotations.Test;

import edu.uniquindio.prmaven.general.TestCore;

public class Calendario_German extends TestCore {
	
	@Test()
	/**
	dataProviderClass = edu.uniquindio.prmaven.dataprovider.DataProviderFactory.class, 
	dataProvider = ConfigurationConstants.DP_FACTORY
	@DataProviderArguments(ConfigurationConstants.ESCENARIO
			+ ConfigurationConstants.EQUALS + DataProvidersConstants.HOJA_1)
			**/
	
	public void testCalendario_German() throws Exception {
		
		try {
			
		selenium.open("/showcase/");
		
		//selenium.click("id=SubMenu-Input"); Seleccionar menu Input
		WebElement menuInput=driver.findElement(By.id("SubMenu-Input"));
		menuInput.click();
		
		//selenium.click(".//*[@id='MENUSIDEindent']/div[3]/a[5]"); Seleccionar Submenu Calendar
		WebElement submenuCalendar=driver.findElement(By.xpath
				("//*[@id='MENUSIDEindent']/div[3]/a[5]"));
		submenuCalendar.click();
		
		selenium.waitForPageToLoad("30000");
		
		//Seleccionar campo german
		//selenium.click("//input[@id='form:german_input']"); xpath //*[@id='form:german_input']
		WebElement campoGerman=driver.findElement(By.xpath("//input[@id='form:german_input']"));
		campoGerman.click();
				
		//Seleccionar fecha
		//	selenium.click("css=a.ui-state-default.ui-state-hover"); 
	   WebElement seleccionFecha=driver.findElement(By.cssSelector("a.ui-state-default.ui-state-hover"));
	   seleccionFecha.click();
	   
	  	
	   //assertEquals(selenium.getValue("id=form:german_input"), "2014-Nov-11");
	   Assert.assertEquals(selenium.getValue("id=form:german_input"), "2014-Nov-11");
	 
		
	    //selenium.click("id=form:j_idt100"); //*[@id='form:j_idt100']
		WebElement boton=driver.findElement(By.xpath("//*[@id='form:j_idt100']"));
		boton.click();
				
		selenium.waitForPageToLoad("30000");
		
		Assert.assertEquals(selenium.getText("css=div.ui-dialog-content.ui-widget-content"), 
				"Inline:Popup:Button:Event:German:11/14/2014Restricted:Multiple:Effect:Mask:Datetime:Time:");

		selenium.waitForPageToLoad("5000");
		
	}catch(AssertionError e){
		System.out.println("no se encontro texto");
	}finally{
		
	}
}

}


